package com.iot.controller;

import com.iot.model.query.ElectronicFenceQuery;
import com.iot.model.dto.ElectronicFenceDto;
import com.iot.service.ElectronicFenceService;
import com.iot.commons.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 
 * @author: dh
 * @date: 2024-04-21 12:17:00
 */
@RestController
@RequestMapping("/electronicFence")
@RequiredArgsConstructor
public class ElectronicFenceController {

    private final ElectronicFenceService electronicFenceService;

    /**
     * 分页条件搜索实现
     * @param electronicFence
     * @return resultList
     */
    @PostMapping(value = "/getList")
    public ResponseResult getList(@RequestBody ElectronicFenceQuery electronicFence) {
        return  electronicFenceService.getList(electronicFence);
    }

    /**
     * 修改
     * @param electronicFence
     * @return
     */
    @PostMapping(value = "/edit")
    public ResponseResult edit(@RequestBody ElectronicFenceDto electronicFence) {
        return electronicFenceService.edit(electronicFence);
    }

    /**
     * 修改
     * @param electronicFence
     * @return
     */
    @PostMapping(value = "/delete")
    public ResponseResult delete(@RequestBody ElectronicFenceDto electronicFence) {
        return electronicFenceService.delete(electronicFence);
    }

    /**
     * 激活
     * @param electronicFence
     * @return
     */
    @PostMapping(value = "/effect")
    public ResponseResult effect(@RequestBody ElectronicFenceDto electronicFence) {
        return electronicFenceService.effect(electronicFence);
    }

    /**
     * 新增
     * @param electronicFence
     * @return
     */
    @PostMapping(value = "/add")
    public ResponseResult add(@RequestBody ElectronicFenceDto electronicFence) {
        return electronicFenceService.add(electronicFence);
    }

    /**
     * 详情
     * @param electronicFence
     * @return
     */
    @PostMapping(value = "/getById")
    public ResponseResult getById(@RequestBody ElectronicFenceQuery electronicFence) {
        return electronicFenceService.getById(electronicFence);
    }
}
